package com.jtech.together.view.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.jtech.together.R;
import com.jtechlib2.adapter.RecyclerAdapter;
import com.jtechlib2.view.RecyclerHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * 表情列表适配器
 * Created by wuxubaiyang on 2017/5/15.
 */

public class EmojiAdapter extends RecyclerAdapter<String> {
    public EmojiAdapter(Context context) {
        super(context);
    }

    public void setDatas(int[] datas) {
        List<String> emojis = new ArrayList<>();
        for (int i = 0; i < datas.length; i++) {
            emojis.add(new String(Character.toChars(datas[i])));
        }
        super.setDatas(emojis);
    }

    @Override
    protected View createView(LayoutInflater layoutInflater, ViewGroup viewGroup, int viewType) {
        return layoutInflater.inflate(R.layout.view_emoji_item, viewGroup, false);
    }

    @Override
    protected void convert(RecyclerHolder holder, String model, int position) {
        //设置表情符号
        holder.setText(R.id.textview_emoji, model);
    }
}